//
//  YIem_SY_One_TOP_View.m
//  B段_开眼
//
//  Created by YIem on 16/5/6.
//  Copyright © 2016年 Howie. All rights reserved.
//

#import "YIem_SY_One_TOP_View.h"
#import "YIem_SY_One_Model.h"
@interface YIem_SY_One_TOP_View ()
@property (nonatomic, strong) UILabel *labelTitle;
@property (nonatomic, strong) UILabel *labelPm;
@property (nonatomic, strong) UILabel *labeldate;
@property (nonatomic, strong) UILabel *labelWeather;
@property (nonatomic, strong) UILabel *labelWind;
@property (nonatomic, strong) UILabel *labelTemperature;
@property (nonatomic, strong) UIImageView *imageDay;
@property (nonatomic, strong) UIImageView *imageNight;

@end
@implementation YIem_SY_One_TOP_View

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        
        /// 城市名字
        self.labelTitle = [[UILabel alloc] init];
        self.labelTitle.textAlignment = NSTextAlignmentCenter;
//        self.labelTitle.backgroundColor = [UIColor redColor];
        [self addSubview:self.labelTitle];
        /// PM2.5
        self.labelPm = [[UILabel alloc] init];
        self.labelPm.textAlignment = NSTextAlignmentCenter;
//        self.labelPm.backgroundColor = [UIColor greenColor];
        [self addSubview:self.labelPm];
        /// 日期
        self.labeldate = [[UILabel alloc] init];
        self.labeldate.textAlignment = NSTextAlignmentCenter;
//        self.labeldate.backgroundColor = [UIColor blueColor];
        [self addSubview:self.labeldate];
        
        /// 天气
        self.labelWeather = [[UILabel alloc] init];
        self.labelWeather.textAlignment = NSTextAlignmentCenter;
//        self.labelWeather.backgroundColor = [UIColor orangeColor];
        [self addSubview:self.labelWeather];
        /// 风
        self.labelWind = [[UILabel alloc] init];
        [self addSubview:self.labelWind];
        /// 温度
        self.labelTemperature = [[UILabel alloc] init];
        [self addSubview:self.labelTemperature];
        /// 白天
        self.imageDay = [[UIImageView alloc] init];
        [self addSubview:self.imageDay];
        /// 晚上
        self.imageNight = [[UIImageView alloc] init];
        [self addSubview:self.imageNight];
        
    }
    return self;
}
- (void)layoutSubviews
{
    [super layoutSubviews];
    
    self.labelTitle.frame = CGRectMake( 0, 0, self.frame.size.width, self.frame.size.height / 4);
    self.labelPm.frame = CGRectMake(0, self.labelTitle.frame.origin.y + self.labelTitle.frame.size.height, self.frame.size.width, self.frame.size.height / 4);
    self.labeldate.frame = CGRectMake(0, self.labelPm.frame.origin.y + self.labelPm.frame.size.height, self.frame.size.width, self.frame.size.height / 4);
    self.labelWeather.frame = CGRectMake(0, self.labeldate.frame.origin.y + self.labeldate.frame.size.height, self.frame.size.width, self.frame.size.height / 4);

    
}
- (void)setTitleStr:(NSString *)titleStr
{
    _titleStr = titleStr;
    self.labelTitle.text = titleStr;
}
- (void)setPmStr:(NSString *)pmStr
{
    _pmStr = pmStr;
    self.labelPm.text = [NSString stringWithFormat:@"当前PM2.5值 :  %@" ,pmStr];
   
}
- (void)setArr:(NSMutableArray *)arr
{
    _arr = arr;
    
    YIem_SY_One_Model *model = [[YIem_SY_One_Model alloc] init];
    model = [arr objectAtIndex:0];
    NSLog(@"%@", arr);
    self.labeldate.text = model.date;
    self.labelWeather.text = model.weather;
    
    
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
